-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
this.timeout() inside describe() doesn't work for me #779
Comments
+1 |
I have the same problem with the "before all" hook. It graps the timeout that I specified globally in stead of the one in the function with |
Hello, are you there? Can someone fix this? I found out two places in code where this is problem, probably - timeout methods calling other timeout methods, but not doing As the system is pretty complex, you know better if adding |
+1 |
i think i recently fixed this. your code worked for me too: describe('something', function(){
this.timeout(500);
it('should take less than 500', function(done){
setTimeout(done, 300);
});
it('should take less than 500 too', function(done){
setTimeout(done, 200);
});
})
|
I voted for this
all before(function(){
this.timeout(500);
})
describe('something', function(){
it('should take less than 500', function(done){
setTimeout(done, 300);
});
it('should take less than 500 too', function(done){
setTimeout(done, 200);
});
}) beforeEach(function(){
this.timeout(500);
})
describe('something', function(){
it('should take less than 500', function(done){
setTimeout(done, 300);
});
it('should take less than 500 too', function(done){
setTimeout(done, 200);
});
}) describe('something', function(){
beforeEach(function(){
this.timeout(500);
})
it('should take less than 500', function(done){
setTimeout(done, 300);
});
it('should take less than 500 too', function(done){
setTimeout(done, 200);
});
}) returns this
my expectations that 500 should be applied for each test Should I create separate issue? |
ok i'm gonna close this then. hopefully you can look into making a pr rather than an issue for the befores. |
Please reopen, |
the case where that would fail is if you're getting the value of the timeout not setting it |
Yes, that's what I had a problem with in the first place. "Dr. Travis Jeffery" notifications@gh.neting.ccnapísal/a:
|
@travisjeffery thanks |
fyi, still seeing this in 3.1.2
|
@JacobRodriguezSSI By using an arrow function, you're not using the |
@agentme: You're right, sorry. In my haste I didn't see the other issue that pointed out this fact. |
For posterity, you can use arrow functions and set the timeout like this:
|
@travisjeffery i used the below script but i got the same Timeout exceed error. Myscript : describe("getBillingDetail", async function (){ Error: Timeout of 55000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. |
This below JS snippet is from the mocha.js website docs, "Suite specific timeouts":
This code example is a bit confusing, when I put the "this.timeout()" call like this I get:
It works if I put it inside my before() for that group of tests, which incidentally was what I intended anyway, but I think either the docs need clarifying or the error message investigating :)
Cheers,
Alex
The text was updated successfully, but these errors were encountered: